//
//  ARVectorViewController.m
//  POCRA
//
//  Created by Marcel Arbó Lack on 26/11/10.
//  Copyright 2010 Mobivery. All rights reserved.
//


#import "ARVectorViewController.h"
#import "ARGeoCoordinate.h"

@implementation ARVectorViewController

@synthesize myazimuth;
@synthesize mylocation;

- (void)dealloc {
	
	[nameLabel release]; nameLabel = nil;
	[distanceLabel release]; distanceLabel = nil;
	
    [super dealloc];
}

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
	
	[nameLabel setTextAlignment:UITextAlignmentLeft];
	[nameLabel setFont:[UIFont fontWithName:@"Helvetica-Bold" size:13.0]];
	[nameLabel setAdjustsFontSizeToFitWidth:NO];
	[nameLabel setBackgroundColor:[UIColor clearColor]];
	[nameLabel setNumberOfLines:2];
	[nameLabel setTextColor:[UIColor whiteColor]];
	[nameLabel setShadowColor:[UIColor blackColor]];
	
	
	[distanceLabel setTextAlignment:UITextAlignmentRight];
	[distanceLabel setFont:[UIFont fontWithName:@"Helvetica" size:14.0]];
	[distanceLabel setAdjustsFontSizeToFitWidth:NO];
	[distanceLabel setBackgroundColor:[UIColor clearColor]];
	[distanceLabel setNumberOfLines:1];
	[distanceLabel setTextColor:[UIColor colorWithRed:(255.0/256.0) green:(218.0/256.0) blue:0.0 alpha:1.0]];
	[distanceLabel setShadowColor:[UIColor blackColor]];
	
}

// Actualiza la distancia hasta el objetivo
- (void)setUpdateDistance:(NSString*)dist {
	[distanceLabel setText:dist];
}

// Actualiza el nombre del vector
- (void)setNameVector:(NSString*)name {
	[nameLabel setText:name];
}

- (void)updateDistance:(CLLocation *)newLocation {
	
	ARGeoCoordinate *geo = [ARGeoCoordinate coordinateWithLocation:newLocation fromOrigin:mylocation];
	
	[distanceLabel setText:[NSString stringWithFormat:@"%fm",geo.radialDistance]];
	
	//NSLog(@"Updating distance in vectorView: %fm", geo.radialDistance);
	
}

@end
